/***
 * 医院设置相关api函数
 */
import {request} from '@utils/http'

import { IHospitalPostParams, IHospitalSetItem, IHospitalSetParams, IHospitalSetResponse } from './model/hospitalSetTypes'
/**
 * 
 * @param {page:当前页，limit:每页显示几条,hosname:医院名称,hoscode:医院编号}
 * @returns Promise<IHospitalSetResponse>
 */
export const getHospitalSetList = ({page,limit,hosname,hoscode}:IHospitalSetParams)=>{
    return request.get<any, IHospitalSetResponse>(`/admin/hosp/hospitalSet/${page}/${limit}`, {
        params:{
            hoscode,
            hosname
        }
    })
}
/**
 * 
 * @param data 添加医院设置请求体
 * @returns  Promise<null>
 */
export const addHospitaSet = (data:IHospitalPostParams)=>{
    return request.post<any,null>('/admin/hosp/hospitalSet/save', data)
}
/**
 * 根据id 获取医院设置
 * @param id 
 * @returns Promise<IHospitalSetItem>
 */
export const getHospitalSet = (id:string|number)=>{
    return request.get<any,IHospitalSetItem>('/admin/hosp/hospitalSet/get/' + id)
}
/**
 * 更新医院设置
 * @param data 最新的医院设置数据
 * @returns null
 */
export const updateHospitalSet = (data:IHospitalSetItem)=>{
    return request.put<any,null>('/admin/hosp/hospitalSet/update', data)
}

/**
 * 根据id删除 医院设置
 * @param id 
 * @returns null
 */
export const deleteHospitalSet = (id:string)=>{
    return request.delete('/admin/hosp/hospitalSet/remove/' + id)
}
/**
 * 根据id批量删除
 * @param idList 
 * @returns null
 */
export const batchRemove = (idList:React.Key[])=>{
    return request.delete('/admin/hosp/hospitalSet/batchRemove',{
        data:idList
    })
}